package org.xb.dao;

import java.sql.Connection;

import org.xb.vo.Corporation;

import com.mysql.jdbc.PreparedStatement;

public class CorporationDAOImpl implements CorporationDAO {
private Connection conn=null;
private PreparedStatement pstmt=null;
public CorporationDAOImpl(Connection conn){
	this.conn=conn;
}
	public boolean doCreate(Corporation corporation) throws Exception {
		boolean flag=false;
		String sql="insert into corporation(cwhere,cname,crole,cplay,csystem,content,chost,cteacher) values(?,?,?,?,?,?,?,?)";
		this.pstmt=(PreparedStatement) this.conn.prepareStatement(sql);
		this.pstmt.setString(1,corporation.getCwhere());
		this.pstmt.setString(2,corporation.getCname());
		this.pstmt.setString(3,corporation.getCrole());
		this.pstmt.setString(4,corporation.getCplay());
		this.pstmt.setString(5,corporation.getCsystem());
		this.pstmt.setString(6,corporation.getContent());
		this.pstmt.setInt(2,corporation.getChost().getUid());
		this.pstmt.setString(7,corporation.getCteacher());
		if(this.pstmt.executeUpdate()>0){
			flag=true;
		}
		return flag;
	}

}
